package com.d0317;

public class CreateThreadByExtends extends Thread {

    @Override
    public void run() {
        System.out.println("CreateThreadByExtends is running");
        System.out.println(currentThread().getName());
    }

    public static void main(String[] args) {
        CreateThreadByExtends createThreadByExtends=new CreateThreadByExtends();
        createThreadByExtends.setName("线程1");
        CreateThreadByExtends createThreadByExtends1=new CreateThreadByExtends();
        createThreadByExtends1.setName("线程2");
        //createThreadByExtends.run(); 错误的 虽然能调出内容但是不能实现并发效果
        createThreadByExtends.start();
        createThreadByExtends1.start();
    }
}
